<template>
  <el-config-provider :locale="locale">
    <RouterView class="mainLay" />
  </el-config-provider>
</template>

<script setup lang="ts">
import { computed, ref, onMounted, nextTick } from 'vue'
import { handleThemeStyle } from '@/utils/theme'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'
import {useStore} from "@/stores";

const language = ref('zh-cn')
const locale = computed(() => (language.value === 'zh-cn' ? zhCn : en))

const toggle = () => {
  language.value = language.value === 'zh-cn' ? 'en' : 'zh-cn'
}

onMounted(() => {
  nextTick(() => {
    const store: any = useStore();
    handleThemeStyle(store.settings.theme)
  })
})

</script>

<style>
html, body {
  padding: 0;
  margin: 0;
}

body .el-table th.gutter{
  display: table-cell!important;
}

p {
  margin: 0;
  padding: 0;
}

#app {
  min-width: 100%;
  min-height: 100%;
  position: absolute;
  display: flex;
  margin: 0;
  padding: 0;
}

.navLay {
  background: red;
  margin: 0;
  padding: 0;
}

.mainLay {
  flex: 1;
}

</style>
